package ai

//go:generate msgp

type AiMode byte

//msgp:tuple ModelAi
type ModelAi struct {
	Commands      []*AiCommandExt `json:"commands" msg:"commands"`
	ScanRadius    int             `json:"scan_radius" msg:"scan_radius"`
	PartnerRadius int             `json:"partner_radius" msg:"partner_radius"`
	AttackRadius  int             `json:"attack_radius" msg:"attack_radius"`
	//Behaviors     []*AiCommandExt `json:"behaviors" msg:"behaviors"`
}

func MakeAi(models []ModelAi) *ActorAi {
	if models == nil {
		return nil
	}
	return &ActorAi{
		Models: models,
	}
}

type AiBehaviorExt struct {
	Behavior byte `json:"type" msg:"type"`
}

//msgp:tuple ActorAi
type ActorAi struct {
	Models []ModelAi `json:"list" msg:"list"`
}

//msgp:tuple AiCommandExt
type AiCommandExt struct {
	Command    byte `json:"type" msg:"type"`
	RelationId int  `json:"relationId" msg:"relationId"`
	Flag       byte `json:"flag" msg:"flag"`

	Conditions [][]*AiConditionExt `json:"list" msg:"list"`
}

//msgp:tuple AiConditionExt
type AiConditionExt struct {
	Type   byte `json:"type" msg:"type"`
	Target byte `json:"target" msg:"target"`
	Select byte `json:"select" msg:"select"`
	Filter byte `json:"filter" msg:"filter"`
	Value  int  `json:"value" msg:"value"`
	Number int  `json:"number" msg:"number"`
	Sort   byte `json:"sort" msg:"sort"`
}

//msgp:tuple GameAiExtend
type GameAiExtend struct {
	Buffs  []int `json:"buff" msg:"buff"`
	Skill  int   `json:"skill" msg:"skill"`
	IsBoss bool  `json:"is_boss" msg:"is_boss"`
}
